package org.ycty.deale;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.ycty.dao.HibernateSessionFactory;
import org.ycty.entity.Imgs;
import org.ycty.entity.Swt;

public class ImgSaveOrUp {
	public Boolean saveOrUpImg(Imgs imgs){
		Boolean b= true;
		Session session = HibernateSessionFactory.getSession();
		Transaction tc = null;
		try {
			tc = session.beginTransaction();
			session.clear();
			session.saveOrUpdate(imgs);
			tc.commit();
		} catch (HibernateException e) {
			// TODO Auto-generated catch block
			 b= false;
			e.printStackTrace();
		}
		return b;
	}
	public Boolean upImg(Imgs imgs) {
		Boolean b= true;
		Session session = HibernateSessionFactory.getSession();
		Transaction tc = null;
		try {
			tc = session.beginTransaction();
			session.clear();
			session.update(imgs);
			tc.commit();
		} catch (HibernateException e) {
			// TODO Auto-generated catch block
			 b= false;
			e.printStackTrace();
		}
		return b;
	}
}
